home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
progs
/
editor
/
frexxed
/
fpl
/
phxassmode.fpl
< prev
next >
Wrap
Text File
|
1996-04-02
|
4KB
|
143 lines
// $Id: PhxAssMode.FPL 1.5 1996/04/02 18:31:39 jskov Exp $
// $VER: PhxAssMode.FPL 1.0 (19.10.95) © Jesper Skov
int parseLine = 0;
int entryID;
//»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» phxAssemble() ««
export void phxAssemble()
{
int parent = GetBufferID();
string path = ReadInfo("file_path");
string me;
int stat;
if(!ReadInfo("filehandler")){
SetInfo(-2,"filehandler",1);
Delay(50); // wait 2 secs
}
me = "\""+ReadInfo("disk_name")+":_phx assemble_\"";
if (!strlen(path))
path = ReadInfo("directory");
if(!(entryID = GetEntryID("_phx assemble_"))){
entryID = New();
parent = CurrentBuffer(entryID);
Rename("_phx assemble_");
CurrentBuffer(parent);
Visible(0);
Activate(entryID,1);
ResizeView(ReadInfo("view_lines")+ReadInfo("view_lines",entryID)-ReadInfo("phxass_output_height"),parent);
Visible(1);
RedrawScreen();
}
Save();
CurrentBuffer(entryID);
GotoLine(1);
CurrentBuffer(parent);
if(Check(path+"Makefile")){
SaveString("T:phxAssemble","echo >"+me+" cd "+path+"\nmake >>"+me);
stat = System("execute t:phxAssemble");
} else
stat = System(ReadInfo("phxass_assembler")+" >"+me+" FROM "+ReadInfo("full_file_name")+" "+ReadInfo("phxass_options"));
if(stat)
ReturnStatus("There were errors! Press C-c ' to find them!");
else
ReturnStatus("Successful operation!");
}
//»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» phxAssParseError() ««
export void phxAssParseError()
{
int parent = CurrentBuffer(entryID);
if(Search("(= line ","=f+")){
if(ReadInfo("line")==1){
ReturnStatus("No errors found!");
CurrentBuffer(parent);
return;
} else {
GotoLine(1);
CurrentBuffer(parent);
ReturnStatus("No more errors found!");
return;
}
} else {
int errLine;
string errFile, errText;
CursorRight(8);
errLine = atoi(GetWord());
CursorRightWord(2);
errFile = substr(GetLine(),ReadInfo("byte_position"),ReadInfo("line_length")-ReadInfo("byte_position")-2);
GotoLine(ReadInfo("line")-1,0);
CursorRightWord();
errText = substr(GetLine(),ReadInfo("byte_position"),ReadInfo("line_length")-ReadInfo("byte_position")-1);
CursorDown(2);
InverseLine(ReadInfo("cursor_y")-1);
InverseLine(ReadInfo("cursor_y")-2);
InverseLine(ReadInfo("cursor_y")-3);
if(stricmp(Stcgfn(errFile),ReadInfo("file_name",parent))){
int other = GetBufferID(Stcgfn(errFile));
if (!other){
other = New();
CurrentBuffer(other);
Load(errFile);
}
CurrentBuffer(other);
Activate(other, 0, parent); // replace parent with erroneous
} else
CurrentBuffer(parent);
GotoLine(errLine);
ReturnStatus(errText);
}
}
//»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» phxAssPrefs() ««
export void PhxAssModePrefs()
{
PromptInfo(-1,"PhxAssMode Preferences",-1,-1,
"phxass_assembler",
"phxass_output_height",
"phxass_options"
);
}
//»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» key bindings ««
AssignKey("phxAssemble();","control c control c", "phxass_mode");
AssignKey("phxAssParseError();","control c '0x2a'","phxass_mode");
//»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» PhxAssMode settings ««
ConstructInfo("phxass_assembler", "","", "GSHW","", 0,0,"phxass");
ConstructInfo("phxass_options", "","", "GSHW","", 0,0,"");
ConstructInfo("phxass_output_height","","","GIHW","",0,100,14);
ConstructInfo("phxass_mode", "","", "LBH","", 0,0,0);
ConstructInfo("phxass_mode_ext", "","", "GSHW","", 0,0,"*s*i*asm*");
ConstructInfo("phxass_mode_exe", "","", "GSHW","", 0,0,"AsmModeInit();");
AddMode(1, "phxass_mode", "phxass_mode_ext", "phxass_mode_exe");
//»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» PhxAss menu ««
MenuAdd("i", "PhxAss", "", "", ReadInfo("Program_Menu"), -1);
MenuAdd("s", "Assemble", "phxAssemble();","", ReadInfo("Program_Menu"), -1);
MenuAdd("s", "---","","",ReadInfo("Program_Menu"), -1);
MenuAdd("s", "Next error", "phxAssParseError();","",ReadInfo("Program_Menu"), -1);
MenuAdd("s", "PhxAss...", "PhxAssModePrefs();", "", ReadInfo("menu_program_title"),ReadInfo("menu_program_item"),-1);
MenuBuild();